# 绘制直方图5-7
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel('餐饮综合数据.xlsx',sheet_name='订单详情表',index_col=0)
plt.rcParams['font.sans-serif'] = 'SimHei'
x = df['价格']
plt.xlabel('菜品单价/元')
plt.ylabel('菜品数量')
plt.title('不同价格区间菜品数量分布直方图')
plt.hist(x,bins=12,color=(0.894,0,0.498),edgecolor='k')
plt.show()

# 数学成绩人数数量分布直方图，区间(0,150)
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel('cjd.xlsx',index_col=0)
plt.rcParams['font.sans-serif'] = 'SimHei'
x = df['数学']
plt.xlabel('数学成绩')
plt.ylabel('人数')
plt.title('数学成绩人数数量分布直方图')
plt.hist(x,bins=12,color=(0.894,0,0.498),edgecolor='k')
plt.show()